<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style>
.name_cls{width:250px;}
</style>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                    <li>
						    知识点编号：<input type="text" name="id"/>
						</li>
						<li>
						    知识点名称：<input type="text" name="name"/>
						</li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="exam:qdb:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary btn-edit disabled" onclick="$.operate.editTree()"
               shiro:hasPermission="exam:qdb:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-info" id="expandAllBtn">
                <i class="fa fa-exchange"></i> 展开/折叠
            </a>
            <!--
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="exam:qdb:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="exam:qdb:export">
						<i class="fa fa-download"></i> 导出
				 </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "exam/qdb";

    $(function () {
        var options = {
            code: "id",
            parentCode: "pid",
            uniqueId: "id",
            url: prefix + "/list",
            createUrl: prefix + "/add/{id}",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove/{id}",
            modalName: "题库",
            columns: [
            {
            field: 'selectItem',
            radio: true
        },
                    /* {
            field: 'pid',
            title: '父级ID',
            align: "left"
        }, */
                        {
            field: 'name',
            title: '知识点名称',
            align: "left"
            //width:250
        },
                        /* {
            field: 'logo',
            title: '题库图标',
            align: "left"
        }, */
                        {
            field: 'status',
            title: '是否开放',
            align: "left",
            formatter: function(value, row, index) {
				if(value){
					return '<span class="badge badge-success">开放</span>';
				}
				return '<span class="badge badge-danger">不开放</span>';
			}
        },
/*                         {
            field: 'remark',
            title: '备注',
            align: "left"
        }, 
                        {
            field: 'poster',
            title: '创建者',
            align: "left"
        },
                        {
            field: 'createdate',
            title: '创建时间',
            align: "left"
        },
                        {
            field: 'modifyor',
            title: '修改者',
            align: "left"
        },
                        {
            field: 'modifydate',
            title: '修改时间',
            align: "left"
        },*/
                        {
                    title: '操作',
                    align: 'left',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-info  btn-xs" href="#" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus">新增</i></a> ');
                        actions.push('<a class="btn btn-danger btn-xs " href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.treeTable.init(options);
    });

</script>
</body>
</html>